<?php
require_once( '../system/loginauth.inc.php' );
session_name( 'ECJP_ADMIN' );
session_start();

if( !isset($_SESSION['ADMIN_LOGIN']['STAFF_ID']) ){
	header("Location: ./login.php");
	exit;
}
$login['autoid']     = $_SESSION['ADMIN_LOGIN']['STAFF_SEQ'];
$login['staff_id']   = $_SESSION['ADMIN_LOGIN']['STAFF_ID'];
$login['staff_name'] = $_SESSION['ADMIN_LOGIN']['STAFF_NAME'];
$login['staff_auth'] = $_SESSION['ADMIN_LOGIN']['STAFF_AUTH'];

$smarty->assign('login', $login );


$aoki_auth = $_SESSION['ADMIN_LOGIN']['STAFF_AUTH_ARR'];

$aokimenu=array(
	  ECJP_AUTH_USER => array("name" => "ログインマスタ","class" => "menu001" ,
	   "li" =>array(
	   	"user_index"  => array("name" => "ユーザ情報一覧"),
	   	"user_form"   => array("name" => "ユーザ情報登録"),
	   	"user_import" => array("name" => "CSV更新")
	   )),
	  ECJP_AUTH_SHOP => array("name" => "店舗マスタ","class" => "menu003" ,
	   "li" =>array(
	   	"mshop_index"  => array("name" => "店舗一覧"),
	   	"mshop_form"   => array("name" => "店舗登録"),
	   	"mshop_import" => array("name" => "CSV更新")
	   )),
	  ECJP_AUTH_INS_SHOP => array("name" => "折込販売店マスタ","class" => "menu002" ,
	   "li" =>array(
	   	"minsshop_index"  => array("name" => "折込販売店一覧"),
	   	"minsshop_form"   => array("name" => "折込販売店登録"),
	   	"minsshop_import" => array("name" => "CSV更新"),
	   	"mins_delive_index"   => array("name" => "納品先マスタ")
	   )),
	   ECJP_AUTH_INS_SHOP_SHOP => array("name" => "販売店紐付けマスタ","class" => "menu009" ,
	   "li" =>array(
	   	"minsshopshop_index"  => array("name" => "販売店紐付け一覧"),
	   	"minsshopshop_form"   => array("name" => "販売店紐付け登録")
	   )),
	   ECJP_AUTH_MATRIX => array("name" => "マトリックスマスタ","class" => "menu004" ,
	   "li" =>array(
	   	"mmatrix_index"  => array("name" => "マトリックス一覧"),
	   	"mmatrix_form"   => array("name" => "マトリックス登録")	  
	   )),
	   ECJP_AUTH_PATTERN => array("name" => "パターンマスタ","class" => "menu005" ,
	   "li" =>array(
	   	"mpattern_index"  => array("name" => "パターン一覧"),
	   	"mpattern_form"   => array("name" => "パターン登録")
	   )),
	   ECJP_AUTH_DNP_AREA => array("name" => "地域広告マスタ","class" => "menu006" ,
	   "li" =>array(
	   	"ddnpwarea_index"  => array("name" => "地域広告情報一覧"),
	   	"ddnpwarea_form"   => array("name" => "地域広告情報登録"),
	   	"ddnparea_import" => array("name"  => "地域広告CSV更新"),
	   	"ddnparea_index"    => array("name" => "DNPエリアマスタ")
	   )),
	   ECJP_AUTH_MAP_GROUP => array("name" => "マップグループマスタ","class" => "menu007" ,
	   "li" =>array(
	   	"mmapg_index"      => array("name"  => "マップグループ一覧"),
	   	"mmapshop_index"   => array("name"  => "マップグループ情報更新"),
	   	"mmapshop_import"  => array("name"  => "CSV更新"),
	   	"mmservice_index"  => array("name"  => "サービスマップマスタ")
	   )),
	   ECJP_AUTH_NEWYEAR => array("name" => "年末年始サマリマスタ","class" => "menu008" ,
	   "li" =>array(
	   	"mnewyear_index"     => array("name" => "年末年始サマリ一覧"),
	   	"mnewyear_form"      => array("name" => "年末年始サマリ登録"),
	   	"mnewyear_week_form" => array("name" => "週名設定"),
	   )),
	   ECJP_AUTH_AJAREKS => array("name" => "AJAREKS紐付けマスタ","class" => "menu010" ,
	   "li" =>array(
	   	"majareks_index"  => array("name" => "AJAREKS紐付け一覧"),
	   	"majareks_import" => array("name" =>  "CSV更新")
	   )),
	   ECJP_AUTH_RHIZOME => array("name" => "リゾームマスタ","class" => "menu015" ,
	   "li" =>array(
	   	"mrhizome_index"  => array("name" => "リゾーム履歴")
	   )),
	   ECJP_AUTH_COST => array("name" => "経費系マスタ","class" => "menu016" ,
	   "li" =>array(
	   	"mcost_flier_index"  => array("name" => "チラシ経費マスタ"),
	   	"mcost_dm_index"     => array("name" => "DM経費マスタ"),
	   	"mcost_tvsp_index"   => array("name" => "TVSPマスタ"),
	   	"mcost_csv_index"    => array("name" => "連携ファイル出力")
	   )),
	   ECJP_AUTH_T_PATTERN => array("name" => "パターン管理","class" => "menu011" ,
	   "li" =>array(
	   	"tpattern_index"      => array("name" => "店別配布明細"),
	   	"tpattern_shop"       => array("name" => "店別パターン部数"),
	   	"tpattern_delive"     => array("name" => "分納明細")
	   )),
	   ECJP_AUTH_MON_CELL => array( "name" => "印刷手配管理","class" => "menu012" ,
	   "li" =>array(
	   	"tmoncell_index"      => array( "name" => "月間セール明細一覧" ),
	   	"tmoncell_form"       => array( "name" => "月間セール明細登録" ),
	   	"tmoncell_update"     => array( "name" => "月間セール明細更新" ),
	   	"tmoncellprn_index"   => array( "name" => "印刷部数明細" ),
	   	"tmoncellshop_index"  => array( "name" => "店舗実施一覧表" )
	   )),
	   ECJP_AUTH_AFCS => array("name" => "チラシ情報サイト","class" => "menu013" ,
	   "li" =>array(
	   	"afcs_index"  =>array("name" =>  "チラシ情報サイト")
	   )),
	   );
		foreach ($aokimenu as $k =>$v ) {
			if ( isset( $aoki_auth[$k] ) ) {
				$aokimenu[$k]["auth"] = TRUE;
			} else {
				$aokimenu[$k]["auth"] = false;
			}
			
			foreach ($v["li"] as $kk =>$vv ) {
				if ( isset( $aoki_auth[$kk] ) ) {
					$aokimenu[$k]["li"][$kk]["auth"] = TRUE;
				} else {
					$aokimenu[$k]["li"][$kk]["auth"] = false;
				}
			}
		}
		

$smarty->assign( 'aokimenu', $aokimenu );

// 権限マスタ
/*
0 管理者
1 ECJP管理者
2 エリアAJA
3 ゾーンAJA
4 折込会社(通常)
5 折込会社(地域広告)
6 印刷会社(大日本)
7 印刷会社(佐川印刷)
8 一般店舗
*/
$arr_auth = array(
	'0'  => 'G-0 管理者',
	'1'  => 'G-1 ECJP管理者',
	'2'  => 'G-2 エリアAJA',
	'3'  => 'G-3 ゾーンAJA',
	'4'  => 'G-4 折込会社(通常)',
	'5'  => 'G-5 折込会社(地域広告)',
	'6'  => 'G-6 印刷会社(大日本)',
	'7'  => 'G-7 印刷会社(佐川印刷)',
	'8'  => 'G-8 一般店舗',
	'9'  => 'G-9 電波圏'
);

// 

?>